﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PersonalAccounting.Business;

namespace PersonalAccounting.Forms
{
    public partial class FormMain : Form
    {

        #region Form

        public FormMain()
        {
            InitializeComponent();
        }

        private void FormMain_Load(object sender, EventArgs e)
        {
            this.Text = Application.ProductName + " v" + Application.ProductVersion;

            if (!ConnectionFacade.Connect())
            {
                MessageBox.Show("Error conectando con la fuente de datos.", this.Text,
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }

        private void FormMain_FormClosed(object sender, FormClosedEventArgs e)
        {
            ConnectionFacade.Disconnect();
        }

        #endregion


        #region Archivo

        private void importarMovimientosToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //ImportarMovtos.ImportarMovtos form = new ImportarMovtos.ImportarMovtos();
            //form.MdiParent = this;
            //form.Show();
        }

        private void salirToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
        
        #endregion

        #region Movimientos

        private void ingresoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormIngresoMovimientos form = new FormIngresoMovimientos();
            form.MdiParent = this;
            form.Show();
        }

        #endregion

        #region Consultas
        
        private void estadoDeCuentaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormConsEstadoDeCuenta form = new FormConsEstadoDeCuenta();
            form.MdiParent = this;
            form.Show();
        }

        private void saldosToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormConsSaldos form = new FormConsSaldos();
            form.MdiParent = this;
            form.Show();
        }

        // separador

        private void totalesPorMesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormConsTotalesPorMes form = new FormConsTotalesPorMes();
            form.MdiParent = this;
            form.Show();
        }

        #endregion

        #region Mantenimientos

        private void monedasToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormMonedaManagement form = new FormMonedaManagement();
            form.MdiParent = this;
            form.Show();
        }

        private void cuentasToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormCuentaManagement form = new FormCuentaManagement();
            form.MdiParent = this;
            form.Show();
        }

        #endregion

    }
}